package org.poliglot.ipa;

/**
 * User: cristi
 * Date: 29.04.2010
 * Time: 22:01:17
 */
public class SpanishPhoneticTranslator extends PhoneticTranslator
{

    protected void processCharacter( char c, StringBuilder sb )
    {
        switch ( c )
        {
            case 'a':
                sb.append( "a" );
                break;
            case 'e':
                sb.append( "e" );
                break;
            case 'i':
                sb.append( "i" );
                break;
            case 'o':
                sb.append( "o" );
                break;
            case 'u':
                sb.append( "u" );
                break;
            case 'y':
                sb.append( "i" );
                break;

            case 'b':
                sb.append( isBetweenVowels() ? '\u03b2' : 'b' );
                break;

            case 'c':
                sb.append( isBefore( pos, 'i', 'e' ) ? '\u03B8' : 'k' );
                break;

            case 'd':
                sb.append( isBetweenVowels() ? '\u00f0' : 'd' );
                break;

            case 'g':
                sb.append( isBefore( pos, 'i', 'e' ) ? 'x' : 'g' );
                break;

            case 'h':
                break;

            case 'j':
                sb.append( "x" );
                break;

            case 'q':
                sb.append( "k" );
                break;

            case 'v':
                sb.append( isBetweenVowels() ? '\u03b2' : 'b' );
                break;

            case 'x':
                sb.append( "ks" );
                break;

            case 'z':
                sb.append( "\u03b8" );
                break;


            default:
                sb.append( c );
        }
    }

}
